package com.wxd.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.mapper.TClinicDepartmentMapper;
import com.guigu.mapper.TDiseaseLibraryMapper;
import com.guigu.pojo.TClinicDepartment;
import com.guigu.pojo.TDiseaseLibrary;
import com.lc.util.Getserial;
import com.wxd.service.TDiseaseService;
import com.wxd.vo.PageVo;
import com.wxd.vo.TDiseaseLibraryTCD;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TDiseaseServiceImpl implements TDiseaseService {
    @Resource
    TDiseaseLibraryMapper tDiseaseLibraryMapper;

    @Resource
    TClinicDepartmentMapper tClinicDepartmentMapper;

    @Resource
    private Getserial getserial;

    @Override
    public PageInfo<TDiseaseLibraryTCD> SelectTDiseaseLibrary(PageVo<TDiseaseLibraryTCD> pageVo) {
        PageHelper.startPage(pageVo.getPage(),pageVo.getPageSize());
        PageInfo<TDiseaseLibraryTCD> bate=new PageInfo<>(this.tDiseaseLibraryMapper.selectTDiseaseLibrary(pageVo.getEntityClass()));
        return bate;
    }

    @Override
    public void DeleteByPrimaryKey(TDiseaseLibrary tDiseaseLibrary) {
        this.tDiseaseLibraryMapper.deleteByPrimaryKey(tDiseaseLibrary);
    }

    @Override
    public void Insert(TDiseaseLibrary tDiseaseLibrary) {
        tDiseaseLibrary.setCode(this.getserial.returnJBid());
        this.tDiseaseLibraryMapper.insert(tDiseaseLibrary);
    }

    @Override
    public void UpdateByPrimaryKey(TDiseaseLibrary tDiseaseLibrary) {
        this.tDiseaseLibraryMapper.updateByPrimaryKey(tDiseaseLibrary);
    }

    @Override
    public List<TClinicDepartment> Query() {
        return this.tClinicDepartmentMapper.query();
    }
}
